home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 3⁄2⁄90 / 0791-Cloning in MacAp-Mar90 < prev    next >
Encoding:
Text File  |  1990-03-02  |  2.1 KB  |  50 lines  |  [TEXT/GEOL]

  1. Item    0857294                         1-March-90        09:04
  2.  
  3. From:   DASNET#                         DASNET, Anna Lange,VCA
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.  
  7. Sub: Re: Cloning in MacAp
  8.  
  9. TO ANSWER, set "Send to" to:  Ravinder.Chandhok@GNOME.CS.CMU.EDU@DASNET#
  10.  
  11.  
  12. > Martin Carlberg <d6maca@dtek.chalmers.se> writes:
  13.  
  14. >MacApp has Clone and ShallowClone, but the funny is that Clone is never
  15. >implemented in any classes except in TObject. If I want to do a shallow clone
  16. >I can call Clone or ShallowClone. If I want a deep clone I have to implement
  17. >my own Clone method even for MacApp's classes and I think THAT is wrong. Look
  18. >at the Free method, it will free objects/data recursively. If I just want to
  19. >free the object I can call ShallowFree. It's not working the same way!?!.
  20. >I think people are wrong when they say that the Clone method should not be
  21. >implemented so objects and data are freed recursively. There are two clone
  22. >methods (Clone and ShallowClone) and let us use both of them.
  23.  
  24. Recent discussion on Macoops has centered on the problems of using "Clone"
  25. in MacApp and Copy in TCL.  One of the fundamental misunderstandings here is
  26. that there is a difference between "cloning" and "copying".  I don't think
  27. they are the same.  Both MacApp and TCL mix the meanings up.
  28.  
  29. For example, if I clone an object, I may want to keep shared references
  30. around, so "free" gets more difficult.  If I "copy" an object, then "free"
  31. should recursively free things for me.
  32.  
  33. So, should there be "freecopy" and "freeclone"?  And should the Object.Free
  34. say "IF Self.fWasClone THEN FreeClone ELSE FreeCopy" ?
  35.  
  36. I use cloning to refer to another way of instantiating new objects from a
  37. dynamic template, like building a TRectangle object from a canonical
  38. TRectangle object that is in a palette (as in several MacApp example
  39. programs).  I use copying when I need an independant copy of an object (to
  40. put in the clipboard, for example).
  41.  
  42. So perhaps when an object is created, via NEW or whatever, it should
  43. remember if it was CLONED, COPIED, or NEWED.  I think the NEWed state is
  44. equal to the COPIED state.  [of course, it would be more fun to have "nude"
  45. objects]
  46.  
  47. Rob
  48.  
  49.  
  50.